//
// Created by 25429 on 2020/8/7.
//
#include "task_limit_up_fast_sell.h"

void task_limit_up_fast_sell::init() {
    strategy_task::init();

    m_phase = LIMIT_UP_PHASE::WAIT_SOME_TIME;

    util::Singleton<my_log>::Instance()->add_log(m_log_title
                                                 + "[m_target_volume]" + to_string(m_target_volume));
}

void task_limit_up_fast_sell::on_md_l2_mkt(const SiriusMDRspMarketField &mkt) {
    m_last_mkt = mkt;
    if (mkt.time >= AM_09_15) {
        switch (m_phase) {
            case LIMIT_UP_PHASE::WAIT_SOME_TIME:
                order_sell_fast();
                m_phase = LIMIT_UP_PHASE::STOP;
                break;
            default:
                break;
        }
    }
}

void task_limit_up_fast_sell::init(int time) {
    strategy_task::init();

    m_phase = LIMIT_UP_PHASE::WAIT_SOME_TIME;

    util::Singleton<my_log>::Instance()->add_log(m_log_title
                                                 + "[m_target_volume]" + to_string(m_target_volume));

}
